package com.cbg.sys.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.cbg.base.core.SuperEntity;
import java.time.LocalDate;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>
 * 排版配置表
 * </p>
 *
 * @author chenbing
 * @since 2018-12-13
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("sys_line_ini")
public class LineIni extends SuperEntity<LineIni> {

    private static final long serialVersionUID = 1L;

    /**
     * 排班时间间隔头
     */
    private String headTime;

    /**
     * 排版时间间隔尾
     */
    private String tailTime;

    /**
     * 间隔数
     */
    private Integer num;

    /**
     * 间隔数单位，12代表分，11代表小时
     */
    private Integer unit;

    /**
     * 排班类型，0为正常排班，1为周末排班，2为临时排班
     */
    private Integer type;

    /**
     * 临时排班日期，仅临时排班才有该字段
     */
    @JsonSerialize(using = LocalDateSerializer.class)
    @JsonDeserialize(using = LocalDateDeserializer.class)
    private LocalDate dateIn;

    /**
     * 路线id
     */
    private String routeId;

    /**
     * 是否已处理，仅临时排班才有该字段
     */
    private Boolean isDone;

    public Boolean getDone() {
        if(getType()!=2){
            return null;
        }
        return isDone;
    }
}
